package com.heimali.sf.config;

import android.content.Context;
import android.content.SharedPreferences;

import com.heimali.sf.SiFaApplication;

public class CommonConfig extends BaseConfig {
	protected static SharedPreferences sp = null;
	public static CommonConfig handle = null;

	@Override
	protected String getSPKey() {
		return "common_config";
	}

	@Override
	protected String getSPKey(String uid) {
		return getSPKey();
	}

	@Override
	protected SharedPreferences getSP() {
		return sp;
	}

	protected CommonConfig() {
		super();
		sp = SiFaApplication.getApplication().getSharedPreferences(getSPKey(), Context.MODE_PRIVATE);
	}

	public static CommonConfig getInstance() {
		if (handle == null) {
			handle = new CommonConfig();
		}
		return handle;
	}

	public static CommonConfig renewInstance() {
		destroyInstance();
		return getInstance();
	}

	public static void destroyInstance() {
		handle = null;
	}
}
